<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
<style>
    .box{
        width: 200px;
        height: 200px;
        border: 3px solid #000;
        font-size: 30px;
        margin-top: 10px;
    }
    .yellowgreen{
        background-color: yellowgreen;
    }
    .big{
        width: 300px;
        height: 300px;
    }
</style>
</head>
<body>
    <div id="app">
        <!--
            动态class
            1.设置对象：是否应用该类名

            2.设置数组:一次性设置多个类名
        -->
      <div class="box" :class="{yellowgreen:flag}"> 程序员 </div>
      <div class="box" :class="['big','yellowgreen']"> 程序员 </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script>
    <script>
        const app = new Vue({
            el:'#app',
            data:{
               flag:true
            },
        })
    </script>
</body>
</html>